const path = require('path');
var express = require('express');
var cors = require("cors");
var bodyParser = require("body-parser");
const Router = require("./router.js");
var app = express();
app.use(cors());
app.use(bodyParser.urlencoded({extended: false}));
const ejs = require('ejs');
app.engine('html', ejs.__express);
app.set('view engine', 'ejs');
app.set('views',path.join(__dirname, './src/views'));
app.use(express.static('./src'));
app.use('/', Router);

// var server = app.listen(80,'116.62.193.156',function () {
//   var host = server.address().address;
//   var port = server.address().port;
//   console.log('Example app listening at http://%s:%s', host, port); 
// //Example app listening at http://192.168.1.104:3000
// });
app.listen(3000, () => console.log('open the internet  http://www.hefatong.com'));